<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Verify and save data from attribute-editorpage
 *
 * @author Norbert Gebert
 * @copyright Norbert Gebert 25.09.2011
 * @license GPL3
 *
 * @version 0.0.6
 * @package Admin
 * @subpackage page
 */
// Test of exist record
$idx = $refValidate->testNumber($_POST['idx'], '');
$titlex = $refValidate->cleanslash($_POST['titlex'], '');

if (!$idx or !$titlex)
{
	message::setErrorRow(_('Submitted Data are wrong format or invalid.') . '<br>' .
		_('No data could be saved!'), TRUE);
}
else
{
	db::getInstance()->where('attribute_id', $idx);
	$result = db::getInstance()->getOne('attribute');

	if (db::getInstance()->count >= 1)
	{
		$data = Array('attribute_title' => $titlex);
		db::getInstance()->where('attribute_id', $idx);

		if (db::getInstance()->update('attribute', $data))
			message::setNoteRow(_('The data was successful saved.'), true);
	}
	else
	{
		message::setErrorRow(_('No data could be saved!'), TRUE);
	}
}
?>